/*
 *email: chen983@sina.com
 */
#include "exception.h"

namespace Oracle{

Exception::Exception(const string &what, int code)
{
	this->_what = what;
	this->_code = code;
}

Exception::Exception(const Exception &org)
{
	this->_what = org._what;
	this->_code = org._code;
}

Exception::~Exception()
{
}

Exception & Exception::operator = (const Exception &right)
{
	this->_what = right._what;
	this->_code = right._code;
	return *this;
}

const string &Exception::what()
{
	return _what;
}

int Exception::code()
{
	return _code;
}

void error_handle(int sqlcode, const char *msg)
{
	if (sqlcode < 0){
		throw new Exception(msg, sqlcode);
	}
}

};
